//
//  WPDiseaseCaseHeaderView.m
//  wobingwoyi
//
//  Created by WGP on 2016/12/5.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPDiseaseCaseHeaderView.h"

@interface WPDiseaseCaseHeaderView ()

@property(nonatomic,strong)UIImageView *iconView;
@property(nonatomic,strong)UILabel *titleLabel;

@end
@implementation WPDiseaseCaseHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = GlobalBgColor;
        
//        UIImageView *topLine = [UIImageView lineImageView];
//        UIImageView *bottomLine = [UIImageView lineImageView];
//        [self.contentView addSubview:topLine];
//        [self.contentView addSubview:bottomLine];
//        
//        [topLine mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.top.equalTo(self.contentView);
//            make.height.mas_equalTo(0.5);
//        }];
//        
//        [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.bottom.equalTo(self.contentView);
//            make.height.mas_equalTo(0.5);
//        }];
        
        [self iconView];
        [self titleLabel];
    }
    return self;
}

-(UIImageView *)iconView
{
    if (_iconView == nil)
    {
        _iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"symptomsDescribed"]];
        [self.contentView addSubview:_iconView];
        
        [_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(10);
            make.centerY.equalTo(self.contentView);
        }];
    }
    return _iconView;
}

-(UILabel *)titleLabel
{
    if(_titleLabel == nil)
    {
        _titleLabel = [UILabel new];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        _titleLabel.text = @"症状描述";
        _titleLabel.textColor = GLobalFontColor;
        [_titleLabel sizeToFit];
        [self.contentView addSubview:_titleLabel];
        
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(self.iconView.mas_right).offset(10);
        }];
    }
    return _titleLabel;
}

-(void)setIndex:(NSInteger)index
{
    _index = index;
    if (index == 1)
    {
        self.iconView.image = [UIImage imageNamed:@"treatmentProcess"];
        self.titleLabel.text = @"治疗过程";
    }
    else
    {
        self.iconView.image = [UIImage imageNamed:@"symptomsDescribed"];
        self.titleLabel.text = @"症状描述";
    }
}

@end
